Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: useStore #50

Merged
merged 6 commits into from
Jun 1, 2024
Merged

feat: useStore #50

merged 6 commits into from
Jun 1, 2024

Conversation

mass8326
Copy link
Contributor

@mass8326 mass8326 commented May 9, 2024

Converts a legacy svelte store into boxed state. Useful when a library requires the use of a store but you would like to work with runes in your own code.

<script lang="ts">
	import { useStore } from "runed";
	import { writable } from "svelte/store";

	const store = writable(0);
	const boxed = useStore(store);
</script>

<div>
	<pre>Boxed: {boxed.value}</pre>
	<button onclick={() => boxed.value++}>Increment via boxed</button>
	<pre>Store: {$store}</pre>
	<button onclick={() => ($store = $store + 1)}>Increment via store</button>
</div>

Copy link

changeset-bot bot commented May 9, 2024

🦋 Changeset detected

Latest commit: 93b80fc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
runed Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented May 9, 2024

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
runed ✅ Ready (View Log) Visit Preview 93b80fc

@github-actions github-actions bot requested a deployment to Preview June 1, 2024 17:22 Abandoned
@TGlide
Copy link
Member

TGlide commented Jun 1, 2024

Thank you!

@TGlide TGlide merged commit 5396353 into svecosystem:main Jun 1, 2024
4 checks passed
@mass8326 mass8326 deleted the use-store branch June 3, 2024 08:22
Tyson910 pushed a commit to Tyson910/runed that referenced this pull request Jun 11, 2024
* feat: `useStore`

* demo

* fix tests

* lint

---------

Co-authored-by: tglide <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants